/**
 * Created by 李华 on 2020/6/21.
 */
const wearDao=require('../dao/wearDao');
//kid 的service
async function findByKind(kind){
    if(kind==null||kind=={}||kind==undefined||kind==[]){
        kind='kid'
    }
    try{
        //查询衣服，能返回
        var data=await wearDao.findByKind(kind);
        return {success:true,wears:data}
    }catch (e){
        //不能返回
        return {success:false,msg:'databse is error'}
    }
};

//men 的service
async function findByMenKind(kind){
    if(kind==null||kind=={}||kind==undefined||kind==[]){
        kind='men'
    }
    try{
        //查询衣服，能返回
        var data=await wearDao.findByKind(kind);
        return {success:true,men:data}
    }catch (e){
        //不能返回
        return {success:false,msg:'databse is error'}
    }
}

//women 的service
async function findByWomenKind(kind){
    if(kind==null||kind=={}||kind==undefined||kind==[]){
        kind='women'
    }
    try{
        //查询衣服，能返回
        var data=await wearDao.findByKind(kind);
        return {success:true,women:data}
    }catch (e){
        //不能返回
        return {success:false,msg:'databse is error'}
    }
}

//mobile 的service
async function findByMobileKind(kind){
    if(kind==null||kind=={}||kind==undefined||kind==[]){
        kind='mobile'
    }
    try{
        //查询衣服，能返回
        var data=await wearDao.findByKind(kind);
        return {success:true,mobile:data}
    }catch (e){
        //不能返回
        return {success:false,msg:'databse is error'}
    }
}


exports.findByKind=findByKind;
exports.findByMenKind=findByMenKind;
exports.findByWomenKind=findByWomenKind;
exports.findByMobileKind=findByMobileKind;
